<div class="card-header  text-white">
    <div class="input-group col-md-12 col-xl-6">
        <input type="text" class="form-control" id="searchName" placeholder="输入教师名称进行搜索">
        <span class="input-group-btn">
			<button class="btn btn-secondary" type="button" id="searchNameBtn">
				<i class="fa fa-search" aria-hidden="true"></i>
			</button>
		</span>
        <a th:if="${isBo}" class="btn btn-primary" data-toggle="modal" data-target="#flipFlop" role="button" id="addTeacher" th:title="添加教师">
            <i class="fa fa-plus" aria-hidden="true"></i>
        </a>
    </div>
    <div  th:if="${isBo}" class="input-group col-md-12 col-xl-6">
        <input id="file" name="file" type="file" class="file" data-show-preview="false"  data-min-file-count="1" multiple>
    </div>
</div>

<div id="mainContainer" class="container" >
    <div id="mainContainerRepleace" class="row">
        <table class="table table-striped">
            <thead>
            <tr>
                <th data-field="teacherId" >ID</th>
                <th data-field="teacherNumber">教师工号</th>
                <th data-field="teacherName">教师姓名</th>
                <th data-field="departmentName">所属院部</th>
                <th data-field="teacherPhone">手机号</th>
                <th data-field="roles">角色</th>
                <th data-field="operation" class="text-center">操作</th>
            </tr>
            </thead>
            <tbody>
            <tr th:each="t : ${teachers}">
                <th th:text="${t.teacherId}">...</th>
                <td th:text="${t.teacherNumber}">...</td>
                <td th:text="${t.teacherName}">...</td>
                <td th:text="${t.departmentInfo.departmentName}">...</td>
                <td th:text="${t.teacherPhone}">...</td>
                <td>
                    <div  th:each="r : ${t.roles}">
                        <span  th:text="${#strings.substring(r.roleName,5,r.roleName.length())}" ></span>
                    </div>
                </td>
                <td class="text-center">
                    <button type="button" class="btn btn-info btn-sm" id="teacher-timetables"  data-th-attr="teacherId=${t.teacherId}"data-toggle="modal" data-target="#flipFlop" aria-hidden="true">课程</button>
                    <button th:if="${isBo}" type="button" class="btn btn-primary btn-sm" data-toggle="modal" id="edit-teacher" data-target="#flipFlop" data-th-attr="teacherId=${t.teacherId}" aria-hidden="true">编辑</button>
                    <button th:if="${isBo}" type="button" class="btn btn-danger btn-sm"  id="delete-teacher"  data-th-attr="teacherId=${t.teacherId}" >删除</button>
                    <button th:if="${isAuthority}" type="button" class="btn btn-primary btn-sm"  id="edit-authority"  data-toggle="modal"  data-target="#flipFlop"  data-th-attr="teacherId=${t.teacherId}" aria-hidden="true">授权</button>
                </td>
            </tr>
            </tbody>
        </table>
        <div th:replace="~{fragments/page :: page}">...</div>
    </div>
</div>

<!-- The modal -->
<div class="modal fade" id="flipFlop" tabindex="-1" role="dialog"
     aria-labelledby="flipFlop"  aria-hidden="true">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title " id="teacherDialogTitle"></h4>
                <button type="button" class="close teacherDialogClose" data-dismiss="modal"
                        aria-label="Close" >
                    <span aria-hidden="true" >&times;</span>
                </button>
            </div>
            <form id="teacherForm"></form>
        </div>
    </div>
</div>


<script src="../../js/teachers/list.js" th:src="@{/js/teachers/list.js}"></script>
